package org.vectrics.recruiter.struts.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.vectrics.provider.CoreServiceLocator;
import org.vectrics.recruiter.user.RecruitPersonSearchCriteria;
import org.vectrics.user.PersonSearchCriteria;

/**
 * Clase encargada de settear los criterios que se van a ver reflejados en las 
 * busquedas.
 * @author pgoette
 */
public class CandidateSearchAction extends PersonSearchAction {
	
	/**
	 * @see PersonSearchAction#SetearCriterio(UserSearchForm, HttpServletRequest)
	 */
	@Override
	protected void SetearCriterio(UserSearchForm form,
			HttpServletRequest request) {
        
		// Creo el criterio.
		this.setCriteria(new RecruitPersonSearchCriteria(CoreServiceLocator.createPersonSearchCriteria()));
		
		super.SetearCriterio(form, request);
	
		this.getCriteria().setNotEmployees(true);
		RecruitPersonSearchCriteria criterio = (RecruitPersonSearchCriteria) this.getCriteria();
		// Deberia setearse las cosas propias de la busquedad de candidato.
		
		HttpSession session = request.getSession();		
		session.setAttribute("userSelectCriteria", criterio);
	}
	
	@Override
	protected UserSearchForm getNewForm() {
		return new CandidateSearchForm();
	}

    @Override
    protected PersonSearchCriteria getNewCriterial() {
    	return new RecruitPersonSearchCriteria(CoreServiceLocator.createPersonSearchCriteria());
    }
	
}
